package twoD.Csg;

import inf.jlinalg.IVector;

public class Rectangle extends Primitive {

	private double ox, oy;
	private double w, h;

	public Rectangle(double ox, double oy, double w, double h) {
		this.ox = ox;
		this.oy = oy;
		this.w = w;
		this.h = h;
	}

	@Override
	public boolean contain(double...p) {
		IVector phat = getInverseLocation(p);
		return (phat.get(0) >= ox - TOL) && ((phat.get(0) - ox) <= w + TOL)
				&& (phat.get(1) >= oy - TOL) && ((phat.get(1) - oy) <= h + TOL);
	}

}
